<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul class="nav">
        <li>测试1</li>
        <li>测试2</li>
        <li>测试3</li>
    </ul>
    <script>
        // 获取每一个小li
        const lis = document.querySelectorAll('.nav li')
        for (let i = 0; i < lis.length; i++) {
            console.dir(lis[i]);
        }
    </script>
</body>

</html>